var Md5 = require('../../utils/md5.js');
var timeSecond = Math.floor(Date.now() * 0.001);  //获取时间戳: 
var SignInfoData = Md5.hexMD5(timeSecond + 'nativetalk');//md5加密;
const app = getApp();
var httpNativetalk = app.globalData.httpNativetalk;
var httpWeike = app.globalData.httpWeike;
Page({
  data: {    
    classBtnIdx: -1,
    otherType: ['不限', '授课时长', '老师好评'],
    otherBtnIdx: 0,
    imgUrl: 'http://file.waijiaojun.com/waijiaojun/icon',
  },
  onLoad: function (e) {
    var that=this;
    wx:wx.request({
      url: httpNativetalk+'/app/15/courseCategoryList',
      data: {},
      header: {
        "Timestamp": timeSecond,
        "SignInfo": SignInfoData,
        "content-Type": "application/json",
        "client_type": "3",
        "version": 15,
        "token": '',
      },
      method: 'POST',
      dataType: 'json',
      success: function(res) {
        console.log(res.data.obj.categories);             
        that.setData({
          classTypeId: res.data.obj.categories
        })
      },
      fail: function(res) {},
      complete: function(res) {},
    })
  },
  classTypeFun: function (e) { 
    var classTypeidx=e.currentTarget.dataset.idx;    
   
    // console.log(classTypeidx)
    switch (classTypeidx) {
       case 1:
      classTypeidx=0;
      break;
       case 7:
      classTypeidx = 1;
      break;
       case 41:
      classTypeidx = 2;
      break;
       case 34:
      classTypeidx = 3;
      break;
       case 12:
      classTypeidx = 4;
      break;
       case 43:
      classTypeidx = 5;
      break;
       case 42:
      classTypeidx = 6;
      break;
       case 44:
      classTypeidx = 7;
      default:
    };
    this.setData({
      classBtnIdx: classTypeidx,
    });
    console.log(classTypeidx)

  },
  otherTypeFun: function (e) {
    this.setData({
      otherBtnIdx: e.currentTarget.dataset.idx,
    });
    console.log(123)
  },
  sureBtnFun:function(){   
    wx.switchTab({
      url: '/pages/OneToOne/OneToOne',
    })
  }
})